package com.huaxin.hxenum.validator;

import com.huaxin.hxenum.enums.ComparisonOperator;
import com.huaxin.hxenum.validation.ValidComparisonOperator;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class ComparisonOperatorValidator implements ConstraintValidator<ValidComparisonOperator, String> {
    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        if (value == null || value.trim().isEmpty()) {
            return true;
        }
        return ComparisonOperator.isValid(value);
    }
}